/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gmovil_jpa.entidades;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author castlerock
 */
@Entity
@Table(name = "plan")
@NamedQueries({
    @NamedQuery(name = "Plan.findAll", query = "SELECT p FROM Plan p"),
    @NamedQuery(name = "Plan.findByIdPlan", query = "SELECT p FROM Plan p WHERE p.idPlan = :idPlan"),
    @NamedQuery(name = "Plan.findByCodigoPlan", query = "SELECT p FROM Plan p WHERE p.codigoPlan = :codigoPlan"),
    @NamedQuery(name = "Plan.findByPlan", query = "SELECT p FROM Plan p WHERE p.plan = :plan"),
    @NamedQuery(name = "Plan.findByFechaUltimaActualizacion", query = "SELECT p FROM Plan p WHERE p.fechaUltimaActualizacion = :fechaUltimaActualizacion"),
    @NamedQuery(name = "Plan.findByPrecioMensualidad", query = "SELECT p FROM Plan p WHERE p.precioMensualidad = :precioMensualidad"),
    @NamedQuery(name = "Plan.findByDescuento", query = "SELECT p FROM Plan p WHERE p.descuento = :descuento"),
    @NamedQuery(name = "Plan.findByIva", query = "SELECT p FROM Plan p WHERE p.iva = :iva"),
    @NamedQuery(name = "Plan.findByActivo", query = "SELECT p FROM Plan p WHERE p.activo = :activo"),
    @NamedQuery(name = "Plan.findByObservacion", query = "SELECT p FROM Plan p WHERE p.observacion = :observacion")})
public class Plan implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_plan")
    private Integer idPlan;
    @Basic(optional = false)
    @Column(name = "codigo_plan")
    private int codigoPlan;
    @Basic(optional = false)
    @Column(name = "plan")
    private String plan;
    @Basic(optional = false)
    @Column(name = "fecha_ultima_actualizacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaUltimaActualizacion;
    @Basic(optional = false)
    @Column(name = "precio_mensualidad")
    private double precioMensualidad;
    @Basic(optional = false)
    @Column(name = "descuento")
    private double descuento;
    @Basic(optional = false)
    @Column(name = "iva")
    private double iva;
    @Basic(optional = false)
    @Column(name = "activo")
    private boolean activo;
    @Column(name = "observacion")
    private String observacion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "plan")
    private List<ValorAtributoPlan> valorAtributoPlanList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "plan")
    private List<ModeloPlan> modeloPlanList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "plan")
    private List<DetalleFacturaPlan> detalleFacturaPlanList;
    @JoinColumn(name = "fid_tipo_pago_plan", referencedColumnName = "id_tipo_pago_plan")
    @ManyToOne
    private TipoPagoPlan tipoPagoPlan;
    @JoinColumn(name = "fid_tipo_cliente_plan", referencedColumnName = "id_tipo_cliente_plan")
    @ManyToOne
    private TipoClientePlan tipoClientePlan;

    public Plan() {
    }

    public Plan(Integer idPlan) {
        this.idPlan = idPlan;
    }

    public Plan(Integer idPlan, int codigoPlan, String plan, Date fechaUltimaActualizacion, double precioMensualidad, double descuento, double iva, boolean activo) {
        this.idPlan = idPlan;
        this.codigoPlan = codigoPlan;
        this.plan = plan;
        this.fechaUltimaActualizacion = fechaUltimaActualizacion;
        this.precioMensualidad = precioMensualidad;
        this.descuento = descuento;
        this.iva = iva;
        this.activo = activo;
    }

    public Integer getIdPlan() {
        return idPlan;
    }

    public void setIdPlan(Integer idPlan) {
        this.idPlan = idPlan;
    }

    public int getCodigoPlan() {
        return codigoPlan;
    }

    public void setCodigoPlan(int codigoPlan) {
        this.codigoPlan = codigoPlan;
    }

    public String getPlan() {
        return plan;
    }

    public void setPlan(String plan) {
        this.plan = plan;
    }

    public Date getFechaUltimaActualizacion() {
        return fechaUltimaActualizacion;
    }

    public void setFechaUltimaActualizacion(Date fechaUltimaActualizacion) {
        this.fechaUltimaActualizacion = fechaUltimaActualizacion;
    }

    public double getPrecioMensualidad() {
        return precioMensualidad;
    }

    public void setPrecioMensualidad(double precioMensualidad) {
        this.precioMensualidad = precioMensualidad;
    }

    public double getDescuento() {
        return descuento;
    }

    public void setDescuento(double descuento) {
        this.descuento = descuento;
    }

    public double getIva() {
        return iva;
    }

    public void setIva(double iva) {
        this.iva = iva;
    }

    public boolean getActivo() {
        return activo;
    }

    public void setActivo(boolean activo) {
        this.activo = activo;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public List<ValorAtributoPlan> getValorAtributoPlanList() {
        return valorAtributoPlanList;
    }

    public void setValorAtributoPlanList(List<ValorAtributoPlan> valorAtributoPlanList) {
        this.valorAtributoPlanList = valorAtributoPlanList;
    }

    public List<ModeloPlan> getModeloPlanList() {
        return modeloPlanList;
    }

    public void setModeloPlanList(List<ModeloPlan> modeloPlanList) {
        this.modeloPlanList = modeloPlanList;
    }

    public List<DetalleFacturaPlan> getDetalleFacturaPlanList() {
        return detalleFacturaPlanList;
    }

    public void setDetalleFacturaPlanList(List<DetalleFacturaPlan> detalleFacturaPlanList) {
        this.detalleFacturaPlanList = detalleFacturaPlanList;
    }

    public TipoPagoPlan getTipoPagoPlan() {
        return tipoPagoPlan;
    }

    public void setTipoPagoPlan(TipoPagoPlan tipoPagoPlan) {
        this.tipoPagoPlan = tipoPagoPlan;
    }

    public TipoClientePlan getTipoClientePlan() {
        return tipoClientePlan;
    }

    public void setTipoClientePlan(TipoClientePlan tipoClientePlan) {
        this.tipoClientePlan = tipoClientePlan;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPlan != null ? idPlan.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Plan)) {
            return false;
        }
        Plan other = (Plan) object;
        if ((this.idPlan == null && other.idPlan != null) || (this.idPlan != null && !this.idPlan.equals(other.idPlan))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gmovil_jpa.entidades.Plan[idPlan=" + idPlan + "]";
    }

}
